UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S3S9blv0pTM8q45RVFU1gcSui6LkDjA1gaRedaM+DKQ='
WHERE
key_id = '2c763ffae756f73c2e37ba7c5b394268470497e82967aa9e0575ce81be612f50'
AND (
token = 'S3S9blv0pTM8q45RVFU1gcSui6LkDjA1gaRedaM+DKQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)