UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'av1wDush+ohSgxATEVdz1JkVrCTNXojdO6pUPExYxN8='
WHERE
key_id = '7a4c65a8cea99ccfc27bceebc20e5ffefbb569611241285b972e8a6033bfc70a'
AND (
token = 'av1wDush+ohSgxATEVdz1JkVrCTNXojdO6pUPExYxN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)