UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FSv4Ztdjg3rgy52JwACtNY75gsYvnn7SdxVffy0VocI='
WHERE
key_id = 'e4a5fe06d6205ec4caa5c38db3c804682a1999254a2020e0d57073e5268318d7'
AND (
token = 'FSv4Ztdjg3rgy52JwACtNY75gsYvnn7SdxVffy0VocI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)