UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SDSC8UZvoc3kNrtuhabfWt7deDsJKl71y5QeK4nfn0U=' 
WHERE 
  key_id = '677f80397d6015aab7bbaa42fc699a3e8fa9a4fa68686c8ce5e466ce8f3c176e' 
  AND (
    token = 'SDSC8UZvoc3kNrtuhabfWt7deDsJKl71y5QeK4nfn0U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037