UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mmJlcUixdU3T7yCf0cuSPXiHiwx83LiKGRi/aZoHEa8='
WHERE
key_id = 'b7a80904b57f8d33b31795487967a51f14b9c3d539237883ec3c23a928940e22'
AND (
token = 'mmJlcUixdU3T7yCf0cuSPXiHiwx83LiKGRi/aZoHEa8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)