UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a3iAFUTSUXLxqKCSRXYVGgZHOFpUyU1fBpXwCVuNMdQ='
WHERE
key_id = '58691900aa035c92d027a4ed810133fa63ea86498b2b89758388809162f1ae33'
AND (
token = 'a3iAFUTSUXLxqKCSRXYVGgZHOFpUyU1fBpXwCVuNMdQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)