UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p5zKKapjOKgkGlaMF4JePeQpnKau2Zvpr0+XWw1ktDk='
WHERE
key_id = '500791d0aa76e3c87a5a0dd2f3161e1dafb9d395c470273e45c5bedc1ec842c5'
AND (
token = 'p5zKKapjOKgkGlaMF4JePeQpnKau2Zvpr0+XWw1ktDk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)