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