UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '97vU/yc6zmdg4bVrLZSpqGuF5t3l+ME7wJ9Ucxfo5ic=' 
WHERE 
  key_id = '04fda7e6a9bd15ca140857e50711d35602207450967948733387192fe13a06d3' 
  AND (
    token = '97vU/yc6zmdg4bVrLZSpqGuF5t3l+ME7wJ9Ucxfo5ic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055