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