UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tksSj1DQ/AX0MIGv6+GqmBv4NosVDkdamdEEh+CJMiA='
WHERE
key_id = 'e1656480ed97afb6dfd5a814950303836005f78de41e1acb31092f0d47a5ab89'
AND (
token = 'tksSj1DQ/AX0MIGv6+GqmBv4NosVDkdamdEEh+CJMiA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)