UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XIYGnesubwBooeoZUCI1PY6r0d7es/RVvamYdzgJkxw=' 
WHERE 
  key_id = 'f388ee51568ae20935010790d9c7bf6dd89220fe400c3062c5dd3f0e8c357515' 
  AND (
    token = 'XIYGnesubwBooeoZUCI1PY6r0d7es/RVvamYdzgJkxw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033