UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M7tzYFp+cd0zklD7Mv4QTOoF9Dg90QKIncUS/GeL0EA=' 
WHERE 
  key_id = '9b4fa06ead52d0a45c28ede95f4ff5c1577ef402ba649c9fa369fb3c290d789a' 
  AND (
    token = 'M7tzYFp+cd0zklD7Mv4QTOoF9Dg90QKIncUS/GeL0EA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031