UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tr3aaWLl89l6LAbYISJtqBvz6SxGZ8NrKE/8+YL6fmU=' 
WHERE 
  key_id = '4affba3015fd2da6bd4da1f8c2af43acd7d6efdedb40c949eb395566183df669' 
  AND (
    token = 'Tr3aaWLl89l6LAbYISJtqBvz6SxGZ8NrKE/8+YL6fmU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039