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