UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w7OvsO7EjzxoUKpXxHLYte9byONG+P7K/9iZiLBy5Kc='
WHERE
key_id = '81302847d993f466930f314af4d83c2c563a092a63f2c5d4f35a7f0990855a6e'
AND (
token = 'w7OvsO7EjzxoUKpXxHLYte9byONG+P7K/9iZiLBy5Kc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)