UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QYzxs2sSN82D+kcu+9XuCmzhmhFjYaqiCSg/+x/FPSw='
WHERE
key_id = 'a4bdfc21011493a4e91245a956cb1bb1990d5b5a22d2e378bc1d201fb6ea1a5f'
AND (
token = 'QYzxs2sSN82D+kcu+9XuCmzhmhFjYaqiCSg/+x/FPSw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)