UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ELyb1yYq8p7Ko2RkiAti3PGHuomMTBThjyd9/VjMccI='
WHERE
key_id = '731ab0537e076efa162ebe05ca4de7bd60b2a711b425f4fd420dc78a71a1767c'
AND (
token = 'ELyb1yYq8p7Ko2RkiAti3PGHuomMTBThjyd9/VjMccI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)