UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yMmFiGZMZgXn6feuYMueTns0Gnf8NZMPWQflhZ7d8S4='
WHERE
key_id = '51e376bbfa1991f516dd3dd4e6121883a208cc9485a5812b4fe9fd7076870728'
AND (
token = 'yMmFiGZMZgXn6feuYMueTns0Gnf8NZMPWQflhZ7d8S4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)