UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0ap+SMVTa58bDDcXCjKH+1muRAdoYYPzjpoa/OrtAFo=' 
WHERE 
  key_id = '9cd5ea94d9f3080cbc3a87fea3316e7d018d89254bf124b869a184868ddc501e' 
  AND (
    token = '0ap+SMVTa58bDDcXCjKH+1muRAdoYYPzjpoa/OrtAFo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037