UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5DMI+eUdZitBwWoQ3i1MkYwfFofjN0HBC0SGCGSbOoY='
WHERE
key_id = 'cfe10952329e51322935696b8b7c4aab867b6f371e4e34f6398b2ea3d9a37a00'
AND (
token = '5DMI+eUdZitBwWoQ3i1MkYwfFofjN0HBC0SGCGSbOoY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)