UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd7AAk3XeZYlGC7bHPYzeHfGzNPbLzE8qyecBxD8PJzk=' 
WHERE 
  key_id = '8fa4469bd42ec1a59a106d44dda04ebaf1de5e10a4fa1a2c08a600e2dfca4893' 
  AND (
    token = 'd7AAk3XeZYlGC7bHPYzeHfGzNPbLzE8qyecBxD8PJzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024