UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WhZuTJzj1Vy1nt7aVDSvGgk3nE+W+FoPT71H2Aie1a8='
WHERE
key_id = 'b3635496424fff7709d02bfc8ad69825e3a0abd928a32461bbd7ceea2cc34614'
AND (
token = 'WhZuTJzj1Vy1nt7aVDSvGgk3nE+W+FoPT71H2Aie1a8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)