UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YtlOohw7WaLhm2yV8lE1eMqWp/LWHtUfG7k+q0CtLIA='
WHERE
key_id = '8d6d957159ca8db68f040e339b7e16d87be2caec08163e8d3dc714785a5bcb6f'
AND (
token = 'YtlOohw7WaLhm2yV8lE1eMqWp/LWHtUfG7k+q0CtLIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)