UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EWubAOWdEXibr/lfiq+6EaZO5AULbe1a8zERVKxaUt4=' 
WHERE 
  key_id = 'a225ba4c10fd6dc060bfe659f1e1d4ddc287e2ff19cd9f83bd023f34e34802a6' 
  AND (
    token = 'EWubAOWdEXibr/lfiq+6EaZO5AULbe1a8zERVKxaUt4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032