UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n7+GdG50dEhGjHvSCWMGonY1nyBFzn8lRC+mgSVE4Gc='
WHERE
key_id = 'a72de3340ae42090cca801a00743a1380d0f3ab518f1889362769f375563b389'
AND (
token = 'n7+GdG50dEhGjHvSCWMGonY1nyBFzn8lRC+mgSVE4Gc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)