UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kxDG3OLljiwF0FgqS/bcM+XYTdMMHwf1jJWSMay4eCg='
WHERE
key_id = '897c415ed02ad789a3026e1f008c2e6f9972e4bbf68476fc49642d7f225a0b8b'
AND (
token = 'kxDG3OLljiwF0FgqS/bcM+XYTdMMHwf1jJWSMay4eCg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)