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