UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WGeFIHS852oP/yghk7tYB9K5cZiGm9S9mWSDS5umABU=' 
WHERE 
  key_id = 'e028166117e4db3d04375fe0d77e0c661a862bc8c45be8cd394433d2707387d2' 
  AND (
    token = 'WGeFIHS852oP/yghk7tYB9K5cZiGm9S9mWSDS5umABU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020