UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BdyDsjijoDq86HD8TxJUDhLyfEEbKwps0Rtqiv0RDB0='
WHERE
key_id = '362a671bb9a705f6ceafb098c92f7c0352d1bbea3c7abf399660ecce8c112f3a'
AND (
token = 'BdyDsjijoDq86HD8TxJUDhLyfEEbKwps0Rtqiv0RDB0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)