UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LwfDjFNqqOfbHwC8Bd3W8SwImIhcUDRK+Rc79G/av/s='
WHERE
key_id = 'fed94b45b5bf77b491191be9e746e1a6dd90863d6f7b5d33cd7ae599655f18dc'
AND (
token = 'LwfDjFNqqOfbHwC8Bd3W8SwImIhcUDRK+Rc79G/av/s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)