UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wIosHe3aYVbWOqUfvVX/IVDfW4CwhegmlDmGfBXfAqU=' 
WHERE 
  key_id = '54fb8480bffaf41e3918ee59f7920bce6ee8f90d21db7f90f28339826151c548' 
  AND (
    token = 'wIosHe3aYVbWOqUfvVX/IVDfW4CwhegmlDmGfBXfAqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034